// src/layouts/CustomLayout.less
@primary-color: #1890ff;
@header-height: 94px;
@tabs-height: 40px;
@nav-menu-height: 48px;
@left-panel-width: 190px;

// 添加新的 CSS 变量用于主题色
:root {
    --header-bg-color: #001529;
    --header-left-bg-color: #002140;
}

.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  
  .header {
    height: @header-height;
    padding: 0;
    // background: #001529;
    display: flex;
    justify-content: space-between;
    z-index: 1;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    min-width: 1024px; // 根据实际情况调整
    // 左侧区域
    .headerLeft {
      width: @left-panel-width;
      height: 100%;
      display: flex;
      flex-direction: column;
    //   background: #002140;
      
      .logoContainer {
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        
        .logoImg {
          height: 100%;
          max-width: 100%;
          object-fit: contain;
        }
      }
      
      .systemTitle {
        height: 34px;
        color: white;
        font-size: 16px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    // 右侧区域
    .headerRight {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: calc(100% - @left-panel-width);
      .navContainer {
        height: @nav-menu-height;
        display: flex;
        position: relative;
        overflow: hidden;
         // 滚动按钮
         .scrollButton {
            color: rgba(255, 255, 255, 0.65);
            background: transparent;
            border: none;
            width: 30px;
            min-width: 30px;
            height: @nav-menu-height;
            z-index: 1;
            
            &:hover {
              color: white;
              background: rgba(255, 255, 255, 0.1);
            }
          }
           // 菜单包装器
         .menuWrapper {
            flex: 1;
            overflow: hidden;
            height: 100%;
            line-height: @nav-menu-height;
            padding: 0 10px; // 增加内边距避免被按钮遮挡
            margin: 0 -10px; // 负边距抵消padding，保持对齐
            min-width: 500px; // 根据实际情况调整
          }
          // 导航菜单
          .navMenu {
            flex: 1;
            height: 100%;
            line-height: @nav-menu-height;
            align-items: center;
            background: transparent;
            white-space: nowrap;
            min-width: 100%;
            display: inline-block;
            background: transparent !important; // 透明背景
            border-bottom: none;
            :global {
                .ant-menu-item, .ant-menu-submenu-title {
                  color: rgba(255, 255, 255, 0.85) !important;
                  
                  &:hover {
                    color: white !important;
                  }
                }

                .ant-menu-item:hover, 
                .ant-menu-submenu:hover{
                background-color: rgba(255, 255, 255, 0.1) !important;
                }

                 // 选中状态（关键修改）
                .ant-menu-item-selected,
                .ant-menu-submenu-selected > .ant-menu-submenu-title {
                color: white !important;
                
                &::after {
                    border-bottom-color: white !important; // 下划线颜色（如果有）
                }
                }
                
                // 选中状态的背景色
                .ant-menu-item-selected {
                background-color: rgba(255, 255, 255, 0.1) !important;
                }
                
                
                // 选中状态的菜单项
                .ant-menu-item-selected {
                  color: white !important;
                  background-color: rgba(255, 255, 255, 0.1) !important;
                }
                
                // 子菜单标题
                .ant-menu-submenu-title {
                  &:hover {
                    color: white !important;
                  }
                }
                
                // 菜单项图标
                .ant-menu-item-icon, .ant-menu-submenu-arrow {
                  color: rgba(255, 255, 255, 0.65) !important;
                }
                
                // 鼠标悬停时的图标颜色
                .ant-menu-item:hover .ant-menu-item-icon,
                .ant-menu-submenu-title:hover .ant-menu-submenu-arrow {
                  color: white !important;
                }
              }
          }
      }
      .tabsContainer {
        height: 46px;
        background: white;
        
        .tabs {
          height: 100%;
          
          :global {
            .ant-tabs-nav {
              margin: 0;
              padding: 0 20px;
              
              .ant-tabs-tab {
                padding: 12px 16px;
                margin: 0;
                border-radius: 0;
                border: none;
              }
              .ant-tabs-tab-active {
                background: fade(@primary-color, 10%);
                color: @primary-color;
              }
            }
            
            .ant-tabs-ink-bar {
              display: none;
            }
          }
        }
      }
    }
  }

  .content {
    flex: 1;
    overflow: hidden; // 禁止外层滚动
    .contentContainer {
    //   padding: 16px;
      overflow: auto; // 允许子页面内部滚动
      height: calc(100% - 32px);
    //   min-height:calc(100% - 32px);
      background: #ffffff;
    }
  }
}

// 用户信息区域
.userInfo {
  height: 100%;
  min-width: 120px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: all 0.3s;
  
  &:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .userName {
    margin-left: 8px;
    font-size: 14px;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
}


// 图标区域样式
.iconArea {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 0 8px;
    
    .icon {
      color: rgba(255, 255, 255, 0.85) !important;
      font-size: 16px;
      margin: 0 5px;
      cursor: pointer;
      transition: all 0.2s;
      padding: 8px;
      
      &:hover {
        color: white !important;
        background: rgba(255, 255, 255, 0.15) !important;
      }
    }
    
    // 徽标样式
    .badge {
      .ant-badge-count {
        box-shadow: none;
        background: @error-color;
        font-size: 10px;
      }
    }
  }

// 添加主题弹窗样式
.themeModal {
    .ant-modal-body {
      padding: 16px;
    }
    
    .themeColors {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      justify-content: center;
    }
    
    .colorBlock {
      width: 100px;
      height: 80px;
      border-radius: 4px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      align-items: center;
      padding: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      transition: all 0.3s ease;
      
      &:hover {
        transform: translateY(-5px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      }
      
      .colorCheck {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.8);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #ddd;
        
        &.active {
          background: @primary-color;
          border-color: @primary-color;
          
          .checkIcon {
            color: white;
            font-weight: bold;
          }
        }
      }
      
      .colorName {
        color: white;
        font-weight: 500;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        background: rgba(0, 0, 0, 0.3);
        padding: 2px 8px;
        border-radius: 10px;
        font-size: 12px;
      }
    }
  }

  .footer {
    position: fixed;
    left:0;
    bottom: 0;
    height: 31px;
    line-height: 31px;
    width: 100%;
    text-align: center;
    font-size: 14px;
    color: #444;
    background: #fff;
    border-top: 1px solid #e7eaec;
    a {
      color: #444;
      cursor: pointer;
      &:hover {
        color: #1890ff;
      }
    }
  }

